// them in the right cell in the table. It doesn't matter if we add them in order
let iter = new Date(this.date);
iter.setSeconds(0); // Leap second protection. Hah!
+ iter.setHours(12);
for (let i = 0; i < 7; i++) {
this.actor.add(new St.Label({ text: iter.toLocaleFormat("%a") }),
{ row: 1,
iter.setTime(iter.getTime() + MSECS_IN_DAY);
}
+ // All the children after this are days, and get removed when we update the calendar
+ this._firstDayIndex = this.actor.get_children().length;
+
this._update();
},
},
_update: function() {
- this._dateLabel.text = this.date.toLocaleFormat("%B %Y");
+ this._dateLabel.text = this.date.toLocaleFormat(this._headerFormat);
// Remove everything but the topBox and the weekday labels
let children = this.actor.get_children();
- for (let i = 8; i < children.length; i++)
+ for (let i = this._firstDayIndex; i < children.length; i++)
children[i].destroy();
// Start at the beginning of the week before the start of the month
let iter = new Date(this.date);
iter.setDate(1);
iter.setSeconds(0);
+ iter.setHours(12);
iter.setTime(iter.getTime() - (iter.getDay() - this._weekStart) * MSECS_IN_DAY);
let now = new Date();
this.calendar = new Calendar.Calendar();
this.actor.add(this.calendar.actor);
+ // Directly adding the actor to Main.chrome.actor is a hack to
+ // work around the fact that there is no way to add an actor that
+ // affects the input region but not the shape.
+ // See: https://bugzilla.gnome.org/show_bug.cgi?id=597044
Main.chrome.actor.add_actor(this.actor);
Main.chrome.addInputRegionActor(this.actor);
this.actor.y = (panelActor.y + panelActor.height - this.actor.height);
const Lang = imports.lang;
const St = imports.gi.St;
-const Calendar =imports.ui.calendar;
+const Calendar = imports.ui.calendar;
const UI = imports.testcommon.ui;
-const Gettext_gtk20 = imports.gettext.domain('gtk20');
-
UI.init();
let stage = Clutter.Stage.get_default();
stage.width = stage.height = 400;